package cn.mumzone.pos.ui.fragment.bills;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import com.github.jdsjlzx.recyclerview.LRecyclerView;
import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import cn.mumzone.basic.base.BaseFragment;
import cn.mumzone.basic.util.ToastUtil;
import cn.mumzone.pos.R;
import cn.mumzone.pos.model.SettleItemEntity;
import cn.mumzone.pos.ui.adapter.ADA_BillSettleList;

/**
 * Created By Dlx
 * on 2019/7/2
 */
public class FRA_CheckOutDetail extends BaseFragment {
    @BindView(R.id.billitem_recyclerview)
    LRecyclerView billitemRecyclerview;

    private List<SettleItemEntity> list = new ArrayList<>();
    private LRecyclerViewAdapter lRecyclerViewAdapter;
    private ADA_BillSettleList adapter;

    @Override
    protected void onUserVisible() {

    }

    @Override
    protected void initEventAndData() {
        LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        billitemRecyclerview.setLayoutManager(layoutManager);
        adapter = new ADA_BillSettleList(mContext, list);
        lRecyclerViewAdapter = new LRecyclerViewAdapter(adapter);
        billitemRecyclerview.setAdapter(lRecyclerViewAdapter);
        billitemRecyclerview.setPullRefreshEnabled(false);
        billitemRecyclerview.setLoadMoreEnabled(false);
    }

    @Override
    protected int getLayout() {
        return R.layout.fra_billitem;
    }

    public void setDatas(List<SettleItemEntity> list) {
        this.list = list;
        adapter.update(this.list);
    }

    public static FRA_CheckOutDetail newInstance(int enterType) {
        FRA_CheckOutDetail fra = new FRA_CheckOutDetail();
        Bundle bundle = new Bundle();
        bundle.putInt("enterType", enterType);
        fra.setArguments(bundle);
        return fra;
    }
}
